<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>上传考试题目</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="bg-light">
    <div class="container mt-5">
        <h1 class="text-center">上传考试题目</h1>

        {% with messages = get_flashed_messages(with_categories=true) %}
        {% if messages %}
            {% for category, message in messages %}
                <div class="alert alert-{{ category }} text-center" role="alert">
                    {{ message }}
                </div>
            {% endfor %}
        {% endif %}
        {% endwith %}

        <form action="{{ url_for('upload_exam', username=username) }}" method="POST" enctype="multipart/form-data">
            <div class="mb-3">
                <label for="exam_name" class="form-label">考试名称:</label>
                <input type="text" id="exam_name" name="exam_name" class="form-control" required>
            </div>
            <div class="mb-3">
                <label for="exam_duration" class="form-label">考试时长 (分钟):</label>
                <input type="number" id="exam_duration" name="exam_duration" class="form-control" required>
            </div>
            <div class="mb-3">
                <label for="questions_file" class="form-label">上传题目文件 (JSON 格式):</label>
                <input type="file" id="questions_file" name="questions_file" class="form-control" required>
            </div>
            <button type="submit" class="btn btn-primary w-100">上传题目</button>
        </form>
    </div>
</body>
</html>
